{include file="common/head"}
<style>
    .carousel {
        width: 100px;
        height: 100px;
        border-radius: 10px;
        border: 1px solid #666;
        margin: 10px;
    }
</style>
<div class="container-fluid">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <header class="card-header">
                    <div class="card-title">网站配置</div>
                </header>
                <div class="card-body">

                    <ul class="nav nav-tabs">
                        <li class="nav-item">
                            <button class="nav-link active" id="basic-config" data-bs-toggle="tab"
                                data-bs-target="#config" type="button">基本</button>
                        </li>
                        <li class="nav-item">
                            <button class="nav-link" id="basic-sys" data-bs-toggle="tab" data-bs-target="#sys"
                                type="button">轮播图</button>
                        </li>
                        <li class="nav-item">
                            <button class="nav-link" id="basic-upload" data-bs-toggle="tab" data-bs-target="#pay"
                                type="button">支付配置</button>
                        </li>
                    </ul>

                    <form action="{:url('/admin/system/update')}" method="post" name="edit-form" class="edit-form">
                        <div class="tab-content">
                            <div class="tab-pane fade show active" id="config" aria-labelledby="basic-sys">
                                <!-- 网页内容基本配置 -->
                                <div class="mb-3">
                                    <label for="title" class="form-label">网站标题</label>
                                    <input class="form-control" type="text" id="title" name="title"
                                        value="{$data.base.title}" placeholder="请输入站点标题">
                                    <small class="form-text">调用方式：<code>config('system.base.title')</code></small>
                                </div>
                                <div class="mb-3">
                                    <label for="logo" class="form-label">LOGO图片</label>
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="logo" id="logo"
                                            value="{$data.base.logo|default=''}">
                                        <button class="btn btn-default upload-img" type="button"
                                            id="upload-logo">上传图片</button>
                                    </div>
                                </div>
                                <div class="mb-3">
                                    <label for="keywords" class="form-label">站点关键词</label>
                                    <input class="form-control" type="text" id="keywords" name="keywords"
                                        value="{$data.base.keywords}" placeholder="请输入站点关键词">
                                    <small class="form-text">网站搜索引擎关键字</small>
                                </div>
                                <div class="mb-3">
                                    <label for="description" class="form-label">站点描述</label>
                                    <textarea class="form-control" id="description" rows="5" name="description"
                                        placeholder="请输入站点描述">{$data.base.description}</textarea>
                                    <small class="form-text">网站描述，有利于搜索引擎抓取相关信息</small>
                                </div>
                                <div class="mb-3">
                                    <label for="copyright" class="form-label">版权信息</label>
                                    <input class="form-control" type="text" id="copyright" name="copyright"
                                        value="{$data.base.copyright}" placeholder="请输入版权信息">
                                    <small class="form-text">调用方式：<code>config('system.base.copyright')</code></small>
                                </div>
                                <div class="mb-3">
                                    <label for="icp" class="form-label">备案信息</label>
                                    <input class="form-control" type="text" id="icp" name="icp" value=""
                                        placeholder="请输入备案信息（无则留空）">
                                    <small
                                        class="form-text">调用方式：<code>config('system.base.web_site_icp')</code></small>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">站点开关</label>
                                    <div class="form-check form-switch">
                                        <input type="checkbox" class="form-check-input" id="site"
                                            {:config('system.switch.site')==1 ? 'checked=""' : '' } name="site">
                                        <label class="form-check-label" for="site"></label>
                                    </div>
                                    <small class="form-text">站点关闭后将不能访问，后台可正常登录</small>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">登录开关</label>
                                    <div class="form-check form-switch">
                                        <input type="checkbox" class="form-check-input" id="login" name="login"
                                            {:config('system.switch.login')==1 ? 'checked=""' : '' }>

                                        <label class="form-check-label" for="login"></label>
                                    </div>
                                    <small class="form-text">关闭后用户将不能登录该系统</small>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">注册开关</label>
                                    <div class="form-check form-switch">
                                        <input type="checkbox" class="form-check-input" id="register"
                                            {:config('system.switch.register')==1 ? 'checked=""' : '' } name="register">

                                        <label class="form-check-label" for="switch_reg"></label>
                                    </div>
                                    <small class="form-text">关闭后用户将不能注册到平台</small>

                                </div>
                                <div class="mb-3">
                                    <label class="form-label">用户审核 (注册)</label>
                                    <div class="form-check form-switch">
                                        <input type="checkbox" class="form-check-input" id="register"
                                            {:config('system.switch.reg_examine')==1 ? 'checked=""' : '' }
                                            name="reg_examine">

                                        <label class="form-check-label" for="switch_reg"></label>
                                    </div>
                                    <small class="form-text">开启后注册的用户需审核才能正常登录</small>
                                </div>
                                <div>
                                    <button type="submit" class="btn btn-primary me-1">确 定</button>
                                </div>

                            </div>
                            <div class="tab-pane fade" id="sys" aria-labelledby="basic-sys">
                                <!-- 轮播图配置 -->
                                <div class="layui-form-item">
                                    <div class="mb-3">
                                        <label for="carousel1" class="form-label">轮播图1</label>
                                        <br>
                                        <img src="{:config('system.carousel.carousel1')}" class="carousel" alt="轮播图1">
                                        <div class="input-group">
                                            <input type="text" class="form-control" name="carousel1" id="carousel1"
                                                value="{:config('system.carousel.carousel1')}">
                                            <button class="btn btn-default upload-img" type="button"
                                                id="carousel1-img">上传图片</button>
                                        </div>
                                        <label for="carousel1_url" class="form-label m-2">跳转地址</label>
                                        <input type="text" class="form-control" placeholder="请输入跳转地址"
                                            value="{:config('system.carousel.carousel1_url')}" name="carousel1_url"
                                            id="carousel1_url" value="">
                                    </div>
                                </div>

                                <div class="mb-3">
                                    <label for="carousel2" class="form-label">轮播图2</label>
                                    <br>
                                    <img src="{:config('system.carousel.carousel2')}" class="carousel" alt="轮播图2">
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="carousel2" id="carousel2"
                                            value="{:config('system.carousel.carousel2')}">
                                        <button class="btn btn-default upload-img" type="button"
                                            id="carousel2-img">上传图片</button>
                                    </div>
                                    <label for="carousel2_url" class="form-label m-2">跳转地址</label>
                                    <input type="text" class="form-control" placeholder="请输入跳转地址"
                                        value="{:config('system.carousel.carousel2_url')}" name="carousel2_url"
                                        id="carousel2_url" value="">
                                </div>
                                <div class="mb-3">
                                    <label for="carousel3" class="form-label">轮播图3</label>
                                    <br>
                                    <img src="{:config('system.carousel.carousel3')}" class="carousel" alt="轮播图3">
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="carousel3" id="carousel3"
                                            value="{:config('system.carousel.carousel3')}">
                                        <button class="btn btn-default upload-img" type="button"
                                            id="carousel3-img">上传图片</button>
                                    </div>
                                    <label for="carousel3_url" class="form-label m-2">跳转地址</label>
                                    <input type="text" class="form-control" placeholder="请输入跳转地址"
                                        value="{:config('system.carousel.carousel3_url')}" name="carousel3_url"
                                        id="carousel3_url" value="">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label" id="carouselSw">轮播图开关</label>
                                    <div class="form-check form-switch">
                                        {if $data.switch.carouselSw}
                                        <input type="checkbox" class="form-check-input" id="carouselSw" checked=""
                                            name="carouselSw">
                                        {else/}
                                        <input type="checkbox" class="form-check-input" id="carouselSw"
                                            name="carouselSw">
                                        {/if}
                                        <label class="form-check-label" for="switch_reg"></label>
                                    </div>
                                    <small class="form-text">关闭后首页将隐藏轮播图</small>
                                </div>
                                <div>
                                    <button type="submit" class="btn btn-primary me-1">确 定</button>
                                </div>
                            </div>
                            <div class="tab-pane fade" id="pay" aria-labelledby="basic-sys">
                                <!-- 支付配置 -->
                                
                                <div class="mb-3">

                                    <!-- <div class="row mb-3">
                                        <div class="col-2">
                                            <div class="form-check">
                                                <input class="form-check-input" type="radio" name="payType"
                                                    id="flexRadioDefault1" value="1" {:config('system.pay.payType') == 1 ? 'checked' : ''}>
                                                <label class="form-check-label" for="flexRadioDefault1">
                                                    易支付
                                                </label>
                                            </div>
                                        </div>
                                        <div class="col-2">
                                            <div class="form-check">
                                                <input class="form-check-input" type="radio" name="payType" value="2"
                                                    id="flexRadioDefault2"  {:config('system.pay.payType') == 2 ? 'checked' : ''}>
                                                <label class="form-check-label" for="flexRadioDefault2">
                                                    码支付
                                                </label>
                                            </div>
                                        </div>
                                    </div> -->
                                    <label for="" class="form-label">商户API (请求地址)</label>
                                    <input type="text" class="form-control mb-2" name="payApi" placeholder="商户API (请求地址)" value="{:config('system.pay.payApi')}">
                                    <label for="" class="form-label">商户ID</label>
                                    <input type="text" class="form-control mb-2" name="payPid" placeholder="商户ID"  value="{:config('system.pay.payPid')}">
                                    <label for="" class="form-label">商户密钥</label>
                                    <input type="text" class="form-control mb-2" name="payKey" placeholder="商户密钥" value="{:config('system.pay.payKey')}">
                                    <p class="mb-3 layui-font-orange">提示：支持易支付 / 码支付2.0 <br>配置信息相同</p>
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </div>
                </div>
                </form>

            </div>
        </div>
    </div>

</div>

</div>
{include file="common/bottom"}
<script>
    layui.use(function () {
        var form = layui.form;
        var layer = layui.layer;
        var upload = layui.upload;
        upload.render({
            elem: '.upload-img',
            field: 'img_path',
            url: '/admin/system/uploadImg', // 此处配置你自己的上传接口即可
            done: function (res) {
                if (res.errno <= 0) {
                    $($(this)[0]['item']).prev().val(res.data.url)
                    $($(this)[0]['item']).parent().prev().prop('src', res.data.url)
                    layer.msg('上传成功，需点击保存才生效哦！')
                }
            }

        });



        // 刷新验证码
        function captcha() {
            $('#captcha')[0].src = '/captcha.html?id=' + Math.random()
        }

        form.on('submit(demo-login)', function (data) {
            var field = data.field; // 获取表单字段值


            return false; // 阻止默认 form 跳转
        });
    });
</script>

</body>

</html>